<%@ include file="/common/taglibs.jsp"%>

<head>
    <title><fmt:message key="vehiculeDetail.title"/></title>
    <meta name="heading" content="<fmt:message key='vehiculeDetail.heading'/>"/>
</head>

<s:form id="vehiculeForm" action="saveVehicule" method="post" validate="true">
    <li style="display: none">
        <s:hidden key="vehicule.id"/>
    </li>
<li>
    <s:checkbox key="vehicule.accidente" cssClass="checkbox" theme="simple"/>
    <!-- For some reason, key prints out the raw value for the label (i.e. true) instead of the i18n key: https://issues.apache.org/struts/browse/WW-1958-->
    <s:label for="vehiculeForm_vehicule_accidente" value="%{getText('vehicule.accidente')}" cssClass="choice desc" theme="simple"/>
</li>
    <s:textfield key="vehicule.anneeSortie" required="false" maxlength="255" cssClass="text" size="11" title="date"/>
    <s:textfield key="vehicule.boiteVitesse" required="false" maxlength="255" cssClass="text medium"/>
    <s:textfield key="vehicule.couleurExterieure" required="false" maxlength="255" cssClass="text medium"/>
    <s:textfield key="vehicule.cylindre" required="false" maxlength="255" cssClass="text medium"/>
    <s:textfield key="vehicule.dateDedouanement" required="false" maxlength="255" cssClass="text" size="11" title="date"/>
<li>
    <s:checkbox key="vehicule.dedouane" cssClass="checkbox" theme="simple"/>
    <!-- For some reason, key prints out the raw value for the label (i.e. true) instead of the i18n key: https://issues.apache.org/struts/browse/WW-1958-->
    <s:label for="vehiculeForm_vehicule_dedouane" value="%{getText('vehicule.dedouane')}" cssClass="choice desc" theme="simple"/>
</li>
    <s:textfield key="vehicule.energie" required="false" maxlength="255" cssClass="text medium"/>
    <s:textfield key="vehicule.kilometrage" required="false" maxlength="255" cssClass="text medium"/>
    <!-- todo: change this to read the identifier field from the other pojo -->
    <s:select name="vehicule.marque.id" list="marques" listKey="id" listValue="libelleMarque"></s:select>
    <s:textfield key="vehicule.modele" required="false" maxlength="255" cssClass="text medium"/>
    <s:textfield key="vehicule.peinture" required="false" maxlength="255" cssClass="text medium"/>
    <s:textfield key="vehicule.portes" required="false" maxlength="255" cssClass="text medium"/>
<li>
    <s:checkbox key="vehicule.premiereMain" cssClass="checkbox" theme="simple"/>
    <!-- For some reason, key prints out the raw value for the label (i.e. true) instead of the i18n key: https://issues.apache.org/struts/browse/WW-1958-->
    <s:label for="vehiculeForm_vehicule_premiereMain" value="%{getText('vehicule.premiereMain')}" cssClass="choice desc" theme="simple"/>
</li>
    <s:textfield key="vehicule.prixDemande" required="false" maxlength="255" cssClass="text medium"/>
    <s:textfield key="vehicule.puissanceFiscale" required="false" maxlength="255" cssClass="text medium"/>
    <s:textfield key="vehicule.texture" required="false" maxlength="255" cssClass="text medium"/>
    <!-- todo: change this to read the identifier field from the other pojo -->
    <s:select name="vehicule.ville.id" list="villes" listKey="id" listValue="nomVille"></s:select>

    <li class="buttonBar bottom">
        <s:submit cssClass="button" method="save" key="button.save" theme="simple"/>
        <c:if test="${not empty vehicule.id}">
            <s:submit cssClass="button" method="delete" key="button.delete"
                onclick="return confirmDelete('Vehicule')" theme="simple"/>
        </c:if>
        <s:submit cssClass="button" method="cancel" key="button.cancel" theme="simple"/>
    </li>
</s:form>

<script type="text/javascript" src="<c:url value='/scripts/calendar/calendar.js'/>"></script>
<script type="text/javascript" src="<c:url value='/scripts/calendar/calendar-setup.js'/>"></script>
<script type="text/javascript" src="<c:url value='/scripts/calendar/lang/calendar-en.js'/>"></script>
<script type="text/javascript">
    Form.focusFirstElement($("vehiculeForm"));
    Calendar.setup({inputField: "vehiculeForm_vehicule_anneeSortie", ifFormat: "%m/%d/%Y", button: "vehicule.anneeSortieDatePicker"});
    Calendar.setup({inputField: "vehiculeForm_vehicule_dateDedouanement", ifFormat: "%m/%d/%Y", button: "vehicule.dateDedouanementDatePicker"});
</script>
